#pragma once
#include "Common.h"
#include "PageCach.h"

//单例模式
class CentralCach {
public:
    static CentralCach* GetInstance() {
        return &sInst_;
    }
    //获取一定内存给 thread cach
    size_t FenchRangeObj(void*& start, void*& end, size_t batchNum, size_t size);
    //获取一个非空的span
    Span* GetOneSpan(SpanList& list, size_t size);

    void  ReleaseListToCentralCach(void* start, size_t size);
private:
    SpanList spanList_[NFREELIST];//span哈希表
    static CentralCach sInst_;

    //单例模式防止外部创建对象
    CentralCach() {};
    CentralCach(const CentralCach&) = delete;
    CentralCach& operator=(const CentralCach&) = delete;
};